/******************************************************************************
* Copyright (C) 2010-2011 Computer Graphics Systems Group at the 
* Hasso-Plattner-Institute (HPI), Potsdam, Germany.
*
* Lecture : Geovisualisation Summer Term 2011
* Exercise: Processing Rendering OpenStreetMap Data 
*
* Author: sebastian.pasewaldt@hpi.uni-potsdam.de
*
******************************************************************************/

#ifndef __STREETNODE_H__
#define __STREETNODE_H__


//[-------------------------------------------------------]
//[ Includes                                              ]
//[-------------------------------------------------------]

#include <osg/Array>
#include <osg/Geode>

#include <QString>

#include "ToggleNode.h"
//[-------------------------------------------------------]
//[ Classes                                               ]
//[-------------------------------------------------------]

class StreetNode: public ToggleNode
{
    //[-------------------------------------------------------]
    //[ Public functions                                      ]
    //[-------------------------------------------------------]
    public:
		/**
		*  @brief
		*    Constructor
		*/
		StreetNode(osg::ref_ptr<osg::Vec3Array> verticies, QString name, unsigned int category);
		QString getFeatureString();

		~StreetNode();

    //[-------------------------------------------------------]
    //[ Private functions                                     ]
    //[-------------------------------------------------------]
    private:
		/**
		*  @brief
		*    sets m_color and m_width based on a given category (encoded as unsigned int)
		*    m_color should define the color of the street and m_width the width
		*/
		void styleStreet(unsigned int category);

        osg::Vec3Array* constructPolyboard(osg::Vec3Array* points);
        osg::Vec3 calculateNormal(const osg::Vec3& v1, const osg::Vec3& v2);


    //[-------------------------------------------------------]
    //[ Private data                                          ]
    //[-------------------------------------------------------]
    private:
		float m_width;
        QString m_name;

};


#endif // __STREETNODE_H__